package com.black.pay.controller;

import com.black.pay.vo.R;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;

public class BaseController {
    protected R validateParams(BindingResult result) {
        if (result.hasErrors()) {
            FieldError fieldError =result.getFieldError();
            String msg =  fieldError.getField()+fieldError.getDefaultMessage();
            return R.fail().put("msg", msg);
        }else {
            return null;
        }
    }
}
